package leetcode;

public class Solution83 {
    public ListNode deleteDuplicates(ListNode head) {
        if(head ==null ){
            return null;
        }
        ListNode tempSlow = head;
        ListNode tempFast = head;

        while(tempFast!=null){
            if(tempFast.val !=tempSlow.val){
                tempSlow.next = tempFast;
                tempSlow = tempSlow.next;
            }
            tempFast= tempFast.next;
        }
        tempSlow.next = null;
        return head;
    }
}
